package com.jk.vehicle.mini.service.impl;

import com.jk.vehicle.mini.dao.UserBicycleCorpMapper;
import com.jk.vehicle.mini.entity.UserBicycleCorp;
import com.jk.vehicle.mini.service.UserBicycleCorpService;
import com.jk.vehicle.core.service.impl.AbstractService;
import com.jk.vehicle.mini.util.QueryUtil;
import com.jk.vehicle.mini.util.SequenceUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Condition;
import tk.mybatis.mapper.entity.EntityColumn;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.mapperhelper.EntityHelper;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Date;

/**
 * This is Description for UserBicycleCorpServiceImpl
 *
 * @author Administrator
 * @date 2021/07/08
 */
@Service
public class UserBicycleCorpServiceImpl extends AbstractService<UserBicycleCorp> implements UserBicycleCorpService {
    /**
	 * 注入UserBicycleCorpMapper
	 */
    @Resource
    private UserBicycleCorpMapper userBicycleCorpMapper;

    /**
    * 根据查询条件查询单表数据
    * @param paramMap 查询条件
    * @return 查询结果
    */
    public List<UserBicycleCorp> queryByParams(Map<String, Object> paramMap){
        Condition condition = new Condition(UserBicycleCorp.class);
        Example.Criteria criteria = condition.createCriteria();
        Map<String, EntityColumn> propertyMap = EntityHelper.getEntityTable(UserBicycleCorp.class).getPropertyMap();
        QueryUtil.spliceQueryParam(criteria, paramMap,  propertyMap, condition);
        return userBicycleCorpMapper.selectByCondition(condition);
    }

    /**
     * 根据用户id查询对应数据源列表
     * @param userId
     * @return
     */
    @Override
    public List<String> queryUserDsNameList(Long userId) {
        return userBicycleCorpMapper.queryUserDsNameList(userId);
    }
}
